package ifosup.matthias.File;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;


public class Main {

	public static void main(String[] args)
	{
		try{	
			File repertoire = new File("TexteFile");
			repertoire.mkdirs();
			File fileTexte = new File(repertoire, "TexteFile.txt");
			fileTexte.delete();
			FileOutputStream font = new FileOutputStream(fileTexte);
			String s ="What's up Doc !";
			font.write(s.getBytes());
			System.out.println(" "+fileTexte.getAbsolutePath());
			
			FileInputStream in = new FileInputStream(fileTexte);
			StringBuffer sb = new StringBuffer();
			int c=0;
			while ((c=in.read())>=0)
			{
				//System.out.print((char)c);
				sb.append((char)c);
			}
			System.out.println(sb.toString());
					
			font.close();
			
		}catch(IOException e)
		{
			e.printStackTrace();
		}

	}

}
